#include "window.h"

Window::Window(QWidget *parent) : FramelessWindow(parent) {
    resize(800, 600);
    setMinimumSize(400, 300);

    TitleBar *titleBar = new TitleBar(this);
    titleBar->raise();
    setTitleBar(titleBar);

    connect(titleBar, &TitleBar::signalButtonMinClicked, this, &Window::showMinimized);
    connect(titleBar, &TitleBar::signalButtonMaxClicked, this, &Window::showMaximized);
    connect(titleBar, &TitleBar::signalButtonRestoreClicked, this, &Window::showNormal);
    connect(titleBar, &TitleBar::signalButtonCloseClicked, this, &Window::close);

    // 主内容区域
    QWidget *content = new QWidget(this);
    content->setStyleSheet("background: white;");

    QVBoxLayout *mainLayout = new QVBoxLayout(content);
    mainLayout->setContentsMargins(20, 20, 20, 20);

    // 标题
    QLabel *title = new QLabel("原生功能无边框窗口演示");
    title->setStyleSheet("font-size: 20px; font-weight: bold; color: #2c3e50;");
    title->setAlignment(Qt::AlignCenter);

    // 功能列表
    QStringList features = {"✓ 原生窗口拖动功能",           "✓ 八方向窗口大小调整", "✓ 任务栏交互支持",
                            "✓ 最大化/最小化/恢复",         "✓ 原生Aero Snap支持",  "✓ 丝滑的缩放效果",
                            "✓ 鼠标移动到边缘自动改变样式", "✓ 四角缩放支持"};

    QVBoxLayout *featureLayout = new QVBoxLayout;
    featureLayout->setSpacing(10);

    for (const QString &feature : features) {
        QLabel *label = new QLabel(feature);
        label->setStyleSheet("font-size: 14px; color: #34495e;");
        featureLayout->addWidget(label);
    }

    // 提示信息
    QLabel *hintLabel = new QLabel("提示：拖动窗口到屏幕边缘可以触发Aero Snap效果");
    hintLabel->setStyleSheet("font-size: 12px; color: #7f8c8d; font-style: italic;");
    hintLabel->setAlignment(Qt::AlignCenter);

    // 添加所有控件到主布局
    mainLayout->addWidget(title);
    mainLayout->addSpacing(20);
    mainLayout->addLayout(featureLayout);
    mainLayout->addStretch();
    mainLayout->addWidget(hintLabel);
    mainLayout->addStretch();

    setCentralWidget(content);
}
Window::~Window() {}